<?php
class StoreCatCitViewModel extends ViewModel{
	public $table ='store';
	public $view =array(
	 		'store' => array(
	 			'_type' => 'INNER'
	 			),
			'category' => array(
				 '_on'  => '__store__.bd_category_cid=__category__.cid',
				 '_type' => 'INNER'
			),
			'city' => array(
				 '_on'  => '__city__.ctid=__store__.bd_city_ctid',
				 '_type' => 'INNER'
			)		
    );
    // 获得所有数据
	public function get_data(){
		return $this->all();
	}
	// 获得一条数据
	public function get_one_data($where = NULL){
		return $this->where($where)->find();
	}
	// 增加
	public function add_data($data=NULL){
		return $this->add($data);
	}
    // 删除
	public function dele($where=NULL){
		return $this->where($where)->delete();
	}
	// 更新
	public function update_data($where=NULL,$data=NULL){
       return $this->where($where)->update($data);
    }
}